/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package listeneryfiltros;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * Web application lifecycle listener.
 *
 * @author lancaster
 */
public class MiPropioEventListener implements ServletContextListener, HttpSessionListener, ServletRequestListener {
    
    ServletContext servletContext;
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        servletContext=sce.getServletContext();
        servletContext.log("contextInitialized() method is invoked ---INICIO CONTEXT INITIALIZED!----");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        servletContext.log("contextDestroyed() method is invoked ----INICIO EL CONTEXT DESTROYED------");
    }

    @Override
    public void sessionCreated(HttpSessionEvent se) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
         servletContext.log("sessionCreated() method is invoked ----CREÓ LA SESION------");
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
         servletContext.log("sessionDestroyed() method is invoked ----CERRÓ LA SESION------");
    }

    @Override
    public void requestDestroyed(ServletRequestEvent sre) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
         servletContext.log("requestDestroyed() method is invoked ----AQUI EL REQUEST DESTROYED------");
    }

    @Override
    public void requestInitialized(ServletRequestEvent sre) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
         servletContext.log("requestInitializerd() method is invoked ----AQUI EL REQUEST INITIALIZED------");
    }
}
